package com.xiaoqi.store.entity;

import lombok.*;

import java.io.Serializable;
import java.util.Date;
import java.util.Objects;

/**
 * @Author Rookie Coder
 * @Description 作为公共基类，存放每个表中都有的信息
 * @Date
 **/
public class BaseEntity implements Serializable {

   private String  createdUser ;
   private Date createdTime ;
   private String  modifiedUser ;
   private Date modifiedTime;


   public BaseEntity(String createdUser, Date createdTime, String modifiedUser, Date modifiedTime) {
      this.createdUser = createdUser;
      this.createdTime = createdTime;
      this.modifiedUser = modifiedUser;
      this.modifiedTime = modifiedTime;
   }

   public BaseEntity() {
   }

   public String getCreatedUser() {
      return createdUser;
   }

   public void setCreatedUser(String createdUser) {
      this.createdUser = createdUser;
   }

   public Date getCreatedTime() {
      return createdTime;
   }

   public void setCreatedTime(Date createdTime) {
      this.createdTime = createdTime;
   }

   public String getModifiedUser() {
      return modifiedUser;
   }

   public void setModifiedUser(String modifiedUser) {
      this.modifiedUser = modifiedUser;
   }

   public Date getModifiedTime() {
      return modifiedTime;
   }

   public void setModifiedTime(Date modifiedTime) {
      this.modifiedTime = modifiedTime;
   }

   @Override
   public boolean equals(Object o) {
      if (this == o) return true;
      if (!(o instanceof BaseEntity)) return false;
      BaseEntity that = (BaseEntity) o;
      return Objects.equals(getCreatedUser(), that.getCreatedUser()) &&
              Objects.equals(getCreatedTime(), that.getCreatedTime()) &&
              Objects.equals(getModifiedUser(), that.getModifiedUser()) &&
              Objects.equals(getModifiedTime(), that.getModifiedTime());
   }

   @Override
   public int hashCode() {
      return Objects.hash(getCreatedUser(), getCreatedTime(), getModifiedUser(), getModifiedTime());
   }

   @Override
   public String toString() {
      return "BaseEntity{" +
              "createdUser='" + createdUser + '\'' +
              ", createdTime=" + createdTime +
              ", modifiedUser='" + modifiedUser + '\'' +
              ", modifiedTime=" + modifiedTime +
              '}';
   }
}
